/*
 * Copyright (c) 2025, 大连理工大学 (Dalian University of Technology)
 *
 * Licensed under the Mulan PSL v2.
 * You can use this file according to the terms and conditions of the Mulan PSL v2.
 * You may obtain a copy of the License at
 *
 *     http://license.coscl.org.cn/MulanPSL2
 *
 * THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
 * EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. SEE THE MULAN PSL v2
 * FOR MORE DETAILS.
 */

#pragma once

#include "DBManager/IRepository/Result/Summary/IEIGENVALUE_CPLXRepository.h"
#include "DBManager/Repository/HDF5/Base/ResultRepositoryBase.h"

template <>
inline HighFive::DataType HighFive::create_datatype<SG::DataStructure::Post::EIGENVALUE_CPLXData> ()
{
    HighFive::CompoundType compoundType = { { "MODE", HighFive::create_datatype<SG::DataStructure::Common::I64> () },
                                            { "ORDER", HighFive::create_datatype<SG::DataStructure::Common::I64> () },
                                            { "REIGEN", HighFive::create_datatype<SG::DataStructure::Common::Real> () },
                                            { "IEIGEN", HighFive::create_datatype<SG::DataStructure::Common::Real> () },
                                            { "FREQ", HighFive::create_datatype<SG::DataStructure::Common::Real> () },
                                            { "DAMP", HighFive::create_datatype<SG::DataStructure::Common::Real> () },
                                            { "SPIN_SPEED", HighFive::create_datatype<SG::DataStructure::Common::Real> () },
                                            { "DOMAIN_ID", HighFive::create_datatype<SG::DataStructure::Common::Id> () } };
    return compoundType;
}

SG_DBMANAGER_HDF5_NAMESPACE_OPEN

class EIGENVALUE_CPLXRepository : public IEIGENVALUE_CPLXRepository,
                                  public SG::DBManager::HDF5::ResultRepositoryBase<SG::DataStructure::Post::EIGENVALUE_CPLXData>
{
  public:
    explicit EIGENVALUE_CPLXRepository (HDF5Database& database);

    void InitialDatasetInfo () override;

    SG::DataStructure::Common::Status Find (SG::DataStructure::Common::Id domainId,
                                            SG::DataStructure::Common::Id entityId,
                                            _OUT std::vector<SG::DataStructure::Post::EIGENVALUE_CPLXData>& entity) override;
};
SG_DBMANAGER_HDF5_NAMESPACE_CLOSE
